const pkg = require('./package')
import Vue from 'vue'

// 在这里描述全局数据
const env = {
  usersinfo: {},
  selected: {},
  use: {},
  ctl: {},
  loading: false,
  cardlength:0
}

Vue.mixin({
  computed: {
    env() {
      return this.$root.$data
    }
  }
})

export default ({ app }, inject) => {
  // 各个组件使用 this.$root.props 引用
  app.data = () => env
}

module.exports = {
  mode: 'spa',
  head: {
    title: '康民健康调理中心',
    meta: [
      {
        charset: 'utf-8'
      },
      {
        name: 'viewport',
        content:
          'width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no'
      },
      {
        hid: 'description',
        name: 'description',
        content: pkg.description
      }
    ],
    link: [
      {
        rel: 'icon',
        type: 'image/x-icon',
        href: '/favicon.ico'
      }
    ],
    script: [
      {
        src: '/js/mui.js',
      },
      {
        src: '/js/mui.picker.js',
      },
      {
        src: '/js/mui.poppicker.js',
      },
 
    ]
  },

  /*
   ** Customize the progress-bar color
   */
  loading: {
    color: '#fff'
  },

  /*
   ** Global CSS
   */
  css: [
    'assets/main.css',
    'assets/border.css',
    'assets/reset.css',
    '~/static/css/mui.css',
    '~/static/css/mui.picker.css',
    '~/static/css/mui.poppicker.css'
  ],

  /*
   ** Plugins to load before mounting the App
   */
  plugins: ['@/plugins/spost', '@/plugins/scroller','~/env'],

  /*
   ** Nuxt.js modules
   */
  modules: ['@nuxtjs/axios'],
  /*
   ** Axios module configuration
   */
  axios: {},

  /*
   ** Build configuration
   */
  build: {
    /*
     ** You can extend webpack config here
     */
    // extend(config, ctx) {
    //   // Run ESLint on save
    //   if (ctx.isDev && ctx.isClient) {
    //     config.module.rules.push({
    //       enforce: 'pre',
    //       test: /\.(js|vue)$/,
    //       loader: 'eslint-loader',
    //       exclude: /(node_modules)/
    //     })
    //   }
    // },
  }
}
